<template>
	<div>
		<el-radio-group v-model="labelPosition" size="small">
		
		</el-radio-group>
		<div style="margin: 20px;"></div>
		<el-form :label-position="labelPosition" label-width="80px" :model="formLabelAlign">
			<el-form-item label="名称" name="username">
				<el-input v-model="formLabelAlign.UserName"></el-input>
			</el-form-item>

			<el-form-item label="性别">
				<el-input v-model="formLabelAlign.Sex"></el-input>
			</el-form-item>

			<el-form-item label="手机号">
				<el-input v-model="formLabelAlign.Tel"></el-input>
			</el-form-item>


			<el-form-item>
				<el-button type="primary" @click="onSubmit">立即修改</el-button>
				<el-button type="primary" @click="quxiao">取消</el-button>
			</el-form-item>

		</el-form>
	</div>
</template>

<script>
	import UserApi from '@/api/UserApi';
	export default {
		data() {
			return {
				labelPosition: 'right',
				formLabelAlign: {
					Id: 0,
					UserName: '',
					Sex: '',
					Tel: ''
				}
			};
		},
		methods: {
			onSubmit() {
				console.log(this.formLabelAlign)
				UserApi.Update(this.formLabelAlign).then(res => {
					if (res.code==1) {
						console.log(res);
						this.$message({
							message:"修改成功",
							type:"success"
						})
						this.$emit('close')
					}
					
				})
			},
			quxiao(){
				this.$emit('close')
			}
		},
		props: ["Id"],
		created() {
			UserApi.get({
				Id: this.Id
			}).then(res => {
				console.log(this.Id);
				this.formLabelAlign = res.data;
			})
		}
	}
</script>

<style>
</style>